$(document).ready(function () { $.widget("trisept.tabblock", $.ui.tabs, { _refresh: function () { this._setOptionDisabled(this.options.disabled); this._setupEvents(this.options.event); this._setupHeightStyle(this.options.heightStyle); this.tabs.not(this.active).attr({ "aria-selected": "false", tabIndex: -1 }); this.panels.not(this._getPanelForTab(this.active)) .hide() .attr({ "aria-hidden": "true" }); // Make sure one tab is in the tab order if (!this.active.length) { this.tabs.eq(0).attr("tabIndex", 0); } else { this.active .attr({ "aria-selected": "true", tabIndex: 0 }); this._addClass(this.active, "ui-tabs-active", "ui-state-active"); this._getPanelForTab(this.active) .show() .attr({ "aria-hidden": "false" }); } }, _toggle: function (event, eventData) { var that = this, toShow = eventData.newPanel, toHide = eventData.oldPanel; this.running = true; function complete() { that.running = false; that._trigger("activate", event, eventData); } function show() { that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); if (toShow.length && that.options.show) { that._show(toShow, that.options.show, complete); } else { toShow.show(); complete(); } } // Start out by hiding, then showing, then completing if (toHide.length && this.options.hide) { this._hide(toHide, this.options.hide, function () { that._removeClass(eventData.oldTab.closest("li"), "ui-tabs-active", "ui-state-active"); show(); }); } else { this._removeClass(eventData.oldTab.closest("li"), "ui-tabs-active", "ui-state-active"); toHide.hide(); show(); } toHide.attr("aria-hidden", "true"); eventData.oldTab.attr({ "aria-selected": "false", }); // If we're switching tabs, remove the old tab from the tab order. // If we're opening from collapsed state, remove the previous tab from the tab order. // If we're collapsing, then keep the collapsing tab in the tab order. if (toShow.length && toHide.length) { eventData.oldTab.attr("tabIndex", -1); } else if (toShow.length) { this.tabs.filter(function () { return $(this).attr("tabIndex") === 0; }) .attr("tabIndex", -1); } toShow.attr("aria-hidden", "false"); eventData.newTab.attr({ "aria-selected": "true", tabIndex: 0 }); }, }); SetupTabs(); SetupTabAccordion(); }); function SetupTabs() { $(".tabs").tabblock(); } function SetupTabAccordion() { $(".accordion-on-mobile .tab-mobile").accordion({ collapsible: true }); }